﻿using Microsoft.AspNetCore.Mvc;
using Zhp.Api.Attributes;
using Zhp.Auth;
using Zhp.IService.Chat;
using Zhp.Model.Chat;
using Zhp.Model.Common;

namespace Zhp.Api.Controllers.Chat
{
    [Route("api/[controller]/[action]")]
    [ApiGroup(GroupName = ApiGroupEnum.Chat)]
    [ApiController]
    public class ChatFriendController : ControllerBase
    {
        private readonly IChatFriendService chatFriendSvc;
        public ChatFriendController(IChatFriendService chatFriendService)
        {
            chatFriendSvc = chatFriendService;
        }

        /// <summary>
        /// 查询聊天好友
        /// </summary>
        /// <returns></returns>
        [AllowOnline]
        [HttpGet()]
        public async Task<ListRet<ChatFriendModel>> GetChatFriendList()
        {
            var list = await chatFriendSvc.GetChatFriendList();

            return new ListRet<ChatFriendModel> { DataList = list };
        }

        [AllowOnline]
        [HttpPost()]
        public async Task<bool> Create(AddChatFriendModel friend)
        {
            return await chatFriendSvc.Create(friend);
        }
    }
}
